package com.leiyuee.designpattern.adapter.adapter;

import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Author : Yu_Lei
 * @create 2024/5/8
 */

@Component(value = "Japan")
public class JapanChargerAdapter implements ChargerAdapter {

    @Resource
    private ChinaChargerAdaptee chinaChargerAdaptee;

    @Override
    public String outputVoltage() {
        System.out.println("购买一个【中国制造】的电源充电器，原始标准输出电压：" + chinaChargerAdaptee.outputVoltage());
        // 模拟电压转换
        String adapterVoltage = String.valueOf(Integer.valueOf(chinaChargerAdaptee.outputVoltage()) - 120);
        System.out.println("电压适配日本标准电压后的输出电压：" + adapterVoltage);
        return "【日本】输出标准电压：" + adapterVoltage;
    }
}
